package cn.hesion.dataStructures.Tree;

public class BinaryTreeDemo {
    public static void main(String[] args) {
        BineryTree bineryTree = new BineryTree();
        TreeNode root = new TreeNode(1, "k");
        TreeNode node2 = new TreeNode(2, "m");
        TreeNode node3 = new TreeNode(3, "p");
        TreeNode node4 = new TreeNode(4, "s");

        root.setLeft(node2);
        root.setRight(node3);
        node3.setLeft(node4);
        bineryTree.setRoot(root);

        bineryTree.preOrder();
        TreeNode node = bineryTree.preOrderSearch(1);
        if(node!=null){
            System.out.println("找到了该节点,具体信息为:"+node);
        }else {
            System.out.println("没有找到该节点");
        }

    }
}
